import * as bm from "/js/baseModule.js";

export class Module extends bm.baseModule {
    constructor(view) {
        super(view);

    }
    afterInstall(){
        let content = this.config.parent.find('.CenterModalContent');
        // 移除关闭按钮
        let height = content.height();
        content.css('margin-top', -height / 2 + 'px');
        setTimeout(function () {
            content.css({'transform': 'scale(1,1)', 'opacity': '1'});
        }, 100);
    }
    setCtx(chargeBill) {
        this.find('.deposit').text(chargeBill.money);
        //充值时的订单号
        this.alipay_code = chargeBill.alipay_code;
    };
    //充值时点击
    _evt_doCharge() {
        let that = this;
        let alipay_code = that.alipay_code;
        let host = window.location.host;
        let protocol = window.location.protocol;
        let transTo = protocol + '//' + host + '#pack/MyPack?fromAliPay=1';
        //对url进行encode
        let afterpayto = encodeURIComponent(transTo);
        let url = APIURL+"/Bill/pay?bill_id=" + alipay_code + '&return_url=' + afterpayto;
        window.location.href = url;
    };

}